package com.audi.activity;

import java.util.ArrayList;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.PopupMenu;
import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;

import com.audi.R;
import com.audi.BaseActivity;
import com.audi.activity.HomeControlActivity;
import com.audi.adapter.ListPlaceCardAdapter;
import com.audi.adapter.SQLiteAsusNewHelper;
import com.audi.dto.PlaceItem;
import com.audi.utils.Constants;
import com.audi.utils.DBHelper;

@SuppressLint("Registered")
public class NewActivityPlaceTab extends BaseActivity {
private ListPlaceCardAdapter listHistoryMem;
	private SQLiteAsusNewHelper mSQLite;
	private ArrayList<PlaceItem> mListMember;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		// Intent intent = getIntent();
	
		setContentView(R.layout.new_activity_place_tab);
		initActionBar(R.layout.action_bar_main);
         
				mSQLite = new SQLiteAsusNewHelper(this);
//		DBHelper.addDataTest(mSQLite);

		// DBHelper.addDataTest(mSQLite);

		ListView list = (ListView) findViewById(R.id.lv_place_tab);

		mListMember = new ArrayList<PlaceItem>();
		mListMember = mSQLite.getListPlace();
		if (mListMember != null && mListMember.size() > 0) {
			listHistoryMem = new ListPlaceCardAdapter(this,
					mListMember, null);
			list.setAdapter(listHistoryMem);
		} else {
			Log.e("--NULLL-----",
					"------------NULLL--------------");
		}
	   list.setOnItemClickListener(new OnItemClickListener() {

		@Override
		public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
				long arg3) {
			
			Intent intentDeviceCard=new Intent(NewActivityPlaceTab.this, NewActivityPlaceInfo.class);
			Bundle bundleInfoPlace = new Bundle();
			
			PlaceItem item=mListMember.get(arg2);
			bundleInfoPlace.putSerializable("item", item);
			
			intentDeviceCard.putExtras(bundleInfoPlace);
			startActivity(intentDeviceCard);	
		}
	});
	
	
	}

	@Override
	public void onRefreshData() {
		// TODO Auto-generated method stub
		
	}
	
	/*
	 * @Override public void refreshData() { // TODO Auto-generated method stub
	 * 
	 * }
	 */

}